import { View, Image } from "@tarojs/components"

import './index.less'
import { useState } from "react"

const bookList = require('../../data/books_1500000.json')

const Record = () => {

    const [currentTab, setCurrentTab] = useState(0)

    const handleChangeTab = (index: number) => {
        setCurrentTab(index)
    }

    return <View className="wrapper">
        <View className="recordList">
            <View className={`recordTab ${currentTab == 0 && 'activeTab'}`} onClick={() => handleChangeTab(0)}> 当前借阅</View>
            <View className={`recordTab ${currentTab == 1 && 'activeTab'}`} onClick={() => handleChangeTab(1)}> 历史借阅</View>
        </View>

        <View className="recordContent">
           {
            bookList.map(item =>  <Image className="recordImage" src={item.image_url}></Image>)
           }

        </View>

    </View>
}

export default Record